package com.Endurancer.manager.controller;

import com.Endurancer.common.core.controller.BaseController;
import com.Endurancer.common.core.domain.AjaxResult;
import com.Endurancer.manager.service.IMsmService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 短信管理Controller
 */
@Api(tags = "短信管理Controller")
@RestController
@RequestMapping("/msm")
@CrossOrigin
public class MsmController extends BaseController {
    @Autowired
    private IMsmService msmService;

    @ApiOperation("发送登录验证码")
    @GetMapping("/login/{phone}")
    public AjaxResult sendLoginMsm(@PathVariable String phone) {
        return msmService.sendMsm(phone, "login");
    }

    @ApiOperation("发送注册验证码")
    @GetMapping("/register/{phone}")
    public AjaxResult sendRegisterMsm(@PathVariable String phone) {
        return msmService.sendMsm(phone, "register");
    }

    @ApiOperation("发送找回密码验证码")
    @GetMapping("/resetPassword/{phone}")
    public AjaxResult sendResetPasswordMsm(@PathVariable String phone) {
        return msmService.sendMsm(phone, "resetPassword");
    }

    @ApiOperation("发送更换手机号验证码")
    @GetMapping("/changePhone/{phone}")
    public AjaxResult sendChangePhoneMsm(@PathVariable String phone) {
        return msmService.sendMsm(phone, "changePhone");
    }

}
